export default {
    data() {
        return {
            user: {},
            show: true,
            activeIndex: '1',
        };
    },
    methods: {
        toCart() {
            this.$router.push('/index/personal/cart')
            console.log('this.$router',this.$router)
        },
        handleSelect(key, keyPath) {
            console.log(key, keyPath);
        },
        layout() {
            this.$confirm('此操作将退出登录, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.show = true
                localStorage.clear()
                this.$message({
                    type: 'success',
                    message: '退出成功!'
                });
                this.$router.push('/login')
            }).catch(() => {
            });
        }
    },
    created() {
        this.user = JSON.parse(localStorage.getItem('currentUser'))
        if (this.user) {
            this.show = false
        } else {
            this.show = true
        }
    }
}